//
//  GameScene.h
//  AtmKiller
//
//  Created by USoft on 6/4/14.
//
//

#ifndef GAME_SCENE_H
#define GAME_SCENE_H

#include "AbstractScene.h"
#include "../../model/include/model.h"
#include "../../util/include/util.h"
#include "../layers/GUIlayer.h"
#include "../layers/UpgradeLayer.h"
#include "../layers/MenuLayer.h"
#include "../layers/AchievementLayer.h"
#include "../layers/CharacterLayer.h"
#include "../layers/UpgradeLayer.h"
#include "../layers/StatisticsLayer.h"
#include "../Layers/ShoppingLayer.h"
#include "../layers/ConversionLayer.h"
#include "../layers/OptionLayer.h"
#include "../../flurryAndroid/AnalyticX.h"
#include "../../flurryIOS/AnalyticX.h"

class GameScene: public AbstractScene {
    UG_PROPERTY_FULL(Face*,atmFace,AtmFace);
protected:
    bool isShaked;
    bool isTurnOffTuto;
    int timeToShowFullScreenAds;
    UGLayer* backgroundLayer;
    UGLayer* midgroundLayer;
    UGLayer* foregroundLayer;
    UGLayer* gameLayer;
    UGLayer* upperGameLayer;
    UGLayer* tutorialLayer;
    UGLayerColor* grayLayer;
    GUILayer* guiLayer;
    MenuLayer* menuLayer;
    AchievementLayer* achievementLayer;
    GameListener* gameListener;
    UpgradeLayer* upgradeLayer;
    StatisticsLayer* statsLayer;
    OptionLayer* optionLayer;
    
    ConversionLayer* conversionLayer;
public:
    GameScene();
    ~GameScene();
    CREATE_FUNC(GameScene);
private:
    void createLayers();
    void createLayersContent();
    void addCharacter();
    void initGame();
    void touchesRegister();
    void addObject(Obj* obj, int zOrder, Layer* layer);
    void removeObject(Obj* obj);
    void fadeObject(int fade, Obj* obj);
    void onTouchesBegan(const std::vector<Touch*>& touches, Event* event);
    void onTouchesEnded(const std::vector<Touch*>& touches, Event* event);

    virtual void update(float dt);
    virtual void onEnter();
    virtual void onExit();
    
    void onEffectAppear(Ref* data);
    void onCoinAppear(Ref* data);
    void onCoinOut(Ref* data);
    void onButtonClick(Ref* sender);
    void onUpgradeAtmFace(Ref* data);
    void callbackDelEffect(Ref* data);
    
    void processPointFly(BigNumber* amount, int coinFrom);
    void delFuncCallback(Ref* data);
};

#endif /* defined(__AtmKiller__GameScene__) */
